xlv.obj.dmProcess={
	extend:function(){
		this.extend('xlv.obj.process');
	},
	implement:function(){
		this.implement('xlv.imp.mvc');
	},
	create:function(tag){
		var div=document.createElement((tag||'div'));
		div.setAttribute('xlvobject','xlv.obj.dmProcess');
		return div;			
	},
	properties:{
		dmName:null,
		methodName:null,
		valueMap:null,
		enableControl:null,
		options:null
	},
	method:{
		initial:function(){
			this.$super('xlv.obj.process.initial');
		},
		valueMap:function(){
			var dm=this.mvc_getModel();
			var map=this.$P.valueMap;
			if(dm&&map){
				for(var v in map){
					var value=dm.getValue(v);
					dm.setValue(value,map[v]);
				}
			}
		},
		process:function(options){
			this.valueMap();
			options=(options||this.$P.options);
			if(this.$P.methodName && this.$P.dmName){
				var dm=this.mvc_getModel();
				if(dm && dm[this.$P.methodName])dm[this.$P.methodName](options);
			}
		},
		mvc_beforeModelChanged:function(dm,notify,memo){
		},
		mvc_modelChanged:function(dm,notify,memo){
		},
		mvc_afterModelChanged:function(dm,notify,memo){
			this.mvc_enableControl(dm);
		},
		mvc_enableControl:function(dm){
			var enable;
			if(this.mvc_isModel(dm)) {
				if(this.$P.enableControl&&Object.isFunction(this.$P.enableControl))
					 enable=this.$P.enableControl();
				else {
					var name=(this.$P.enableControl)?this.$P.enableControl:this.$P.methodName+'able';
					if(!dm[name])return null;
					enable=dm[name]();
				}
				if(enable)this.disabled=false;
				if(enable===false)this.disabled=true;
			}
			return enable;
		}
	}
};
